package com.example.javafx.bilibilidownload.util

import java.util.prefs.Preferences

object SettingsManager {

    val prefs = Preferences.userNodeForPackage(javaClass)

    @JvmStatic
    fun save(key: String, value: String) {
        prefs.put(key, value)
    }

    @JvmStatic
    fun load(key: String): String? {
        return prefs.get(key, null)
    }

    @JvmStatic
    fun clear(key: String) {
        prefs.remove(key)
    }

    @JvmStatic
    fun saveInt(key: String, value: Int) {
        prefs.putInt(key, value)
    }

    @JvmStatic
    fun loadInt(key: String): Int {
        return prefs.getInt(key, 0)
    }
}